package com.ruoyi.system.service.impl;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import org.springframework.stereotype.Service;

@Service
   public class UrlCheckService {

       public boolean isUrlAccessible(String url) {
           try {
               OkHttpClient client = new OkHttpClient();
               Request request = new Request.Builder()
                      .url(url)
                      .build();
               Response response = client.newCall(request).execute();
               return response.isSuccessful();
           } catch (Exception e) {
               return false;
           }
       }
   }
